Ext.regModel('Pref', {
    fields: [
        { name: 'id', type: 'int'},
        { name: 'login', type: 'string' },
        { name: 'password', type: 'password' }
    ],
    proxy: {
        type: 'localstorage',
        id  : 'uPrefs'
    }
});

Ext.regModel('Entry', {
    fields: [
        { name: 'id', type: 'string'},
        { name: 'name', type: 'string' }
    ]
});

Ext.regModel('EntryPoint', {
    fields: [
        { name: 'id', type: 'int'},
        { name: 'name', type: 'string' }
    ]
});


var prefsStore = new Ext.data.Store({
    model: 'Pref',
    record: false,
    autoLoad: false,
    
    listeners:{
        load: function(){
            if ( !(this.record = prefsStore.getById(1)) ) {
                prefsStore.add({id:1});
                this.record = prefsStore.getById(1)
            } else {
                dataSync.setCredentials(this.record);
            }
            prefsPanel.load(this.record)
        }
    }
    
});
